<?php

define('IN_QY', true);
session_start();
require("include/common.inc.php");
//$_COOKIE['userid'] = '151202475870';
if (!$_COOKIE['userid']) {
    echo "<script type='text/javascript'>location.href='login.php';</script>";
    exit;
}

$order_id = $_GET['oid'];
$sql = "select * from tbl_taorder where uid='" . $_COOKIE['userid'] . "' and orderid='" . $order_id . "'";
$query = mysql_query($sql);
$resu = mysql_fetch_array($query);
if (!$resu) {
    echo "<script type='text/javascript'>alert('订单不存在!');history.go(-1);</script>";
    exit;
}
$sql = "select * from tbl_taorder where uid='" . $_COOKIE['userid'] . "' and orderid='" . $order_id . "' and is_pay=1";
$query = mysql_query($sql);
$resut = mysql_fetch_array($query);
if ($resut) {
    echo "<script type='text/javascript'>alert('订单已支付!');history.go(-1);</script>";
    exit;
}

//优惠券判断
$coupon0 = array();//饼干
$coupon1 = array();//牙膏
$coupon2 = array();//洗洁精
$coupon3 = array();//香皂
$coupon4 = array();//酒水饮料
$coupon5 = array();//麦片奶粉
$coupon6 = array();//全品类
$coupon7 = array();//红酒
$sql = "select t1.*,t2.typeid,t2.ggnum,t2.typeid,t2.entitle,t2.encode from tbl_taorder t1 inner join tbl_taospp t2 on t1.goodid=t2.id where t1.orderid='" . $order_id . "'";
$query = mysql_query($sql);
while ($rowhyq = mysql_fetch_array($query)) {
    $totpri = $rowhyq['gnum'] * $rowhyq['gprice'];//总价
    $coupon6[] = $totpri;
    if ($rowhyq['typeid'] == 2) {
        $coupon4[] = $totpri;
    }
    if ($rowhyq['entitle'] == 7) {
        $coupon0[] = $totpri;
    } elseif ($rowhyq['entitle'] == 15) {
        $coupon1[] = $totpri;
    } elseif ($rowhyq['entitle'] == 14) {
        $coupon2[] = $totpri;
    } elseif ($rowhyq['entitle'] == 12) {
        $coupon3[] = $totpri;
    } elseif ($rowhyq['entitle'] == 5 || $rowhyq['entitle'] == 6) {
        $coupon5[] = $totpri;
    } elseif ($rowhyq['entitle'] == 9) {
        $coupon7[] = $totpri;
    }
}

//计算运费

$proarr1 = array(9, 1, 10, 11, 16, 18, 17, 12, 14, 19);
$proarr2 = array(3, 2, 13, 22, 15, 23, 20, 21);
$proarr3 = array(27, 4, 7, 24, 6, 25, 8, 5, 28, 29, 30);
$proarr4 = array(26);
$proarr5 = array(31);
$numarr = array();
$numarr1 = array();
$weiarr = array();
$priarr = array();
$tempyb = "";
$sql = "select t1.*,t2.typeid,t2.ggnum,t2.typeid,t2.entitle,t2.encode,t2.hotlevel,t2.ggunit,t3.youb from tbl_taorder t1 inner join tbl_taospp t2 on t1.goodid=t2.id inner join tbl_address t3 on t1.uid=t3.userid where t1.orderid='" . $order_id . "' and t3.moren=1 group by t1.id";
$query = mysql_query($sql);
$row = mysql_fetch_array($query);
$typeid = $row['typeid'];

$totpri = $row['gnum'] * $row['gprice'];//总价
//if ($row['entitle'] != 9) {
    $priarr[] = $totpri;
//}

if ($row['sku_id']) {
    $sku_info = c_getRow("select * from tbl_goods_sku WHERE id = " . $row['sku_id']);
    $sku_weight = $sku_info['sku_weight'];
}

$weight = "";//重量
$d_w = $row['encode']; // 单价重量
if ($sku_weight) {
    $d_w = $sku_weight;
}

// 如果是红酒就包邮 cj
$baoyou = c_getRows("select type from tbl_sb_baoyou");
if(in_array($row['entitle'] ,array_column($baoyou,'type'))){
    $d_w = 0;
}

$weight = $row['gnum'] * $d_w;
$weiarr[] = $weight;

//if ($row['typeid'] == 2 && $row['entitle'] != 9 && $row['entitle'] != 18) {
//    $numarr[] = $row['gnum'];
//}
//if ($row['entitle'] == 18) {
//    $numarr1[] = $row['gnum'];//椰子
//}
$tempyb = $row['youb'];

//运费
//$delinum = array_sum($numarr);
//$delinum1 = array_sum($numarr1);
//$delifee = $delinum * 40;
//$delifee1 = $delinum1 * 20;
$wei = array_sum($weiarr);
$weis = ceil($wei);
$pri = array_sum($priarr);
$express = "";

// 变量
$hotlevel = $row['hotlevel']; // 热销
$ggunit = $row['ggunit']; // 自营

if ($wei == 0) {
    $express = 0;
} elseif ($wei <= 1 && $wei > 0) {
    if (in_array($tempyb, $proarr1)) {
        $express = 12;
    } elseif (in_array($tempyb, $proarr2)) {
        $express = 15;
    } elseif (in_array($tempyb, $proarr3)) {
        $express = 20;
    } elseif (in_array($tempyb, $proarr4)) {
        $express = 25;
    } elseif (in_array($tempyb, $proarr5)) {
        $express = 30;
    }
} else {
    if (in_array($tempyb, $proarr1)) {
        $express = 12 + ($weis - 1) * 5;
    } elseif (in_array($tempyb, $proarr2)) {
        $express = 15 + ($weis - 1) * 8;
    } elseif (in_array($tempyb, $proarr3)) {
        $express = 20 + ($weis - 1) * 10;
    } elseif (in_array($tempyb, $proarr4)) {
        $express = 25 + ($weis - 1) * 20;
    } elseif (in_array($tempyb, $proarr5)) {
        $express = 30 + ($weis - 1) * 18;
    }
}

//$totfee = $delifee + $delifee1 + $express;
$totfee = $express;
$sql = "update tbl_taorder set expresstri='" . $totfee . "' where orderid='" . $order_id . "'";
mysql_query($sql);


?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <title>订单</title>
    <link rel="stylesheet" href="/ui/layui/css/layui.css">
    <link href="/ui/two/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css"/>
    <link href="/ui/two/basic/css/demo.css" rel="stylesheet" type="text/css"/>
    <link href="/ui/two/css/cartstyle.css" rel="stylesheet" type="text/css"/>
    <link href="/ui/two/css/jsstyle.css" rel="stylesheet" type="text/css"/>
    <script src="/sy/adz/js/jquery.min.js"></script>
    <script type="text/javascript" src="fetch/js/address.js"></script>
    <script src="/ui/layui/layui.js"></script>
    <script src="/ui/layer/layer.js"></script>
    <style>
        #searchnav {
            height: 20px;
            text-align: center;
            margin-left: 18px;
        }

        #searchnav p {
            height: 100%;
            width: 48px;
            margin-right: 6px;
            border-radius: 10px 10px 0 0;
            float: left;
            cursor: pointer;
            color: #fff;
            background: linear-gradient(#f86b54, #dc4835);
        }
    </style>
</head>

<body onmousemove="Aaa()">

<!--顶部导航条 -->
<? include('head1.php'); ?>

<form action="taorderconf.php" method="post" onsubmit="return checktax()">
    <input type="hidden" name="orderid" value="<?php echo $order_id; ?>">
    <div class="concent">
        <!--地址 -->
        <div class="paycont">
            <div class="address">
                <h3>确认收货地址 </h3>

                <div class="clear"></div>
                <ul>
                    <div class="per-border"></div>
                    <?php
                    $sql = "select * from tbl_address where userid='" . $_COOKIE['userid'] . "' and moren=1";
                    $query = mysql_query($sql);
                    $row = mysql_fetch_array($query);
                    ?>

                    <li class="user-addresslist <?php if ($row['moren'] == 1) {
                        echo "defaultAddr";
                    }; ?> ">

                        <div class="address-left">
                            <div class="user DefaultAddr">

                    <span class="buy-address-detail">   
                                <span class="buy-user"><?php echo $row['name']; ?></span>
                      <span class="buy-phone"><?php echo $row['tell']; ?></span>
                    </span>
                            </div>
                            <div class="default-address DefaultAddr">
                                <span class="buy-line-title buy-line-title-type">收货地址：</span>
                                <span class="buy--address-detail">
                      <?php echo $row['diqu']; ?><?php echo $row['dizhi']; ?>
                    </span>
                            </div>

                            <ins class="deftip">默认地址</ins>

                        </div>
                        <div class="address-right">
                            <span class="am-icon-angle-right am-icon-lg"></span>
                        </div>
                        <div class="clear"></div>

                    </li>
                </ul>

                <div class="clear"></div>
            </div>

            <!--订单 -->
            <div class="concent">
                <div id="payTable">
                    <h3>确认订单信息</h3>
                    <div class="cart-table-th">
                        <div class="wp">

                            <div class="th th-item">
                                <div class="td-inner">商品信息</div>
                            </div>
                            <div class="th th-price">
                                <div class="td-inner">单价</div>
                            </div>
                            <div class="th th-amount">
                                <div class="td-inner">数量</div>
                            </div>
                            <div class="th th-sum">
                                <div class="td-inner">金额</div>
                            </div>
                            <!-- <div class="th th-oplist">
                              <div class="td-inner">配送费</div>
                            </div> -->

                        </div>
                    </div>
                    <div class="clear"></div>
                    <?php
                    $sql = "select t1.*,t2.chtitle,t2.img,t2.unit from tbl_taorder t1 inner join tbl_taospp t2 on t1.goodid=t2.id where t1.orderid='" . $order_id . "'";
                    $querytao = mysql_query($sql);
                    while ($row = mysql_fetch_array($querytao)) {
                        $temp = $row['img'];
                        $imgarr = explode(",", $temp);
                        ?>
                        <tr class="item-list">
                            <div class="bundle  bundle-last">

                                <div class="bundle-main">
                                    <ul class="item-content clearfix">
                                        <div class="pay-phone">
                                            <li class="td td-item">
                                                <div class="item-pic">
                                                    <a href="taogoodetail.php?id=<?php echo $row['goodid']; ?>"
                                                       class="J_MakePoint">
                                                        <img src="<?php echo $imgarr[0]; ?>" width="80" height="80"
                                                             class="itempic J_ItemImg"></a>
                                                </div>
                                                <div class="item-info">
                                                    <div class="item-basic-info">
                                                        <a href="taogoodetail.php?id=<?php echo $row['goodid']; ?>"
                                                           class="item-title J_MakePoint"
                                                           data-point="tbcart.8.11"><?php echo $row['chtitle']; ?></a>
                                                    </div>
                                                </div>
                                            </li>
                                            <li class="td td-info">
                                                <div class="item-props">
                            <span class="sku-line">购买单位：
                                <?php if ($row['bunit'] == 1) {
                                    echo $row['unit'];
                                } elseif ($row['bunit'] == 2) {
                                    echo "箱";
                                } ?>
                            </span>
                                                </div>
                                                <?php if ($row['bunit'] == 2) { ?>
                                                    <div class="item-props">
                              <span class="sku-line">箱规数量:<?php echo $row['bnum']; ?>           
                              </span>
                                                    </div>
                                                <?php } ?>
                                            </li>
                                            <li class="td td-price">
                                                <div class="item-price price-promo-promo">
                                                    <div class="price-content">
                                                        <em class="J_Price price-now"><?php echo floatval($row['gprice']); ?></em>
                                                    </div>
                                                </div>
                                            </li>
                                        </div>
                                        <li class="td td-amount">
                                            <div class="amount-wrapper ">
                                                <div class="item-amount ">
                                                    <span class="phone-title">购买数量</span>
                                                    <div class="sl">
                                                        <em class="J_Price price-now"><?php echo $row['gnum']; ?></em>
                                                    </div>
                                                </div>
                                            </div>
                                        </li>
                                        <li class="td td-sum">
                                            <div class="td-inner">
                                                <em tabindex="0"
                                                    class="J_ItemSum number"><?php echo floatval($row['totprice']); ?></em>
                                            </div>
                                        </li>
                                        <!--  <li class="td td-oplist">
                        <div class="td-inner">
                          <span class="phone-title">配送费</span>
                          <div class="pay-logis">
                            <b class="sys_item_freprice"><?php echo floatval($row['expresstri']); ?></b>元
                          </div>
                        </div>
                      </li> -->

                                    </ul>
                                    <div class="clear"></div>

                                </div>
                        </tr>
                    <?php } ?>
                    <div class="clear"></div>
                </div>

            </div>
            <!--订单结束 -->
            <div class="pay-total">
                <?php
                $sql = "select sum(totprice+expresstri) as totfee,sum(expresstri) as totexp from tbl_taorder where orderid='" . $order_id . "'";
                $query = mysql_query($sql);
                $rowfee = mysql_fetch_array($query);

                ?>
                <!--运费 -->
                <div class="order-extra" style="width:100%;">
                    <div class="order-user-info" style="float:left;">
                        <div id="holyshit257" class="memo">
                            <label>运费：</label>
                        </div>
                    </div>
                    <div style="float:right;">
                        <?php echo floatval($rowfee['totexp']); ?>元
                    </div>
                </div>
                <!--优惠券 -->
                <?php if ($typeid != 19) { ?>
                    <div class="order-extra" style="width:100%;">
                        <div class="order-user-info" style="float:left;">
                            <div id="holyshit257" class="memo">
                                <label>优惠券使用：</label>
                            </div>
                        </div>
                        <div style="float:right;">

                            <select name="yhq" id="yhq">
                                <option value="">选择优惠券</option>
                                <? if ($ggunit == 0) { ?>
                                    <!-- 自营商品优惠券规则 start -->
                                    <!--25 -->
                                    <?php
                                    $z = "select * from tbl_yhq where userid='" . $_COOKIE['userid'] . "' and state=1 and type=1 and UNIX_TIMESTAMP(lasttime)>UNIX_TIMESTAMP(now()) and money=25";
                                    $x = mysql_query($z);
                                    $rows25 = mysql_fetch_array($x);
                                    if ($rows25) {
                                        $coupon70 = array_sum($coupon7);
                                        if ($coupon70 >= 399) {
                                            ?>
                                            <option value="<?php echo $rows25['money'] . 'and' . $rows25['id']; ?>"
                                                    style="text-align: center;">
                                                代金券：￥<?php echo $rows25['money'] ?></option>
                                        <?php } ?>
                                    <?php } ?>
                                    <!--20 -->
                                    <?php
                                    $z = "select * from tbl_yhq where userid='" . $_COOKIE['userid'] . "' and state=1 and type=1 and UNIX_TIMESTAMP(lasttime)>UNIX_TIMESTAMP(now()) and money=20";
                                    $x = mysql_query($z);
                                    $rows20 = mysql_fetch_array($x);
                                    if ($rows20) {
                                        $coupon60 = array_sum($coupon6);
                                        if ($coupon60 >= 500) {
                                            ?>
                                            <option value="<?php echo $rows20['money'] . 'and' . $rows20['id']; ?>"
                                                    style="text-align: center;">
                                                代金券：￥<?php echo $rows20['money'] ?></option>
                                        <?php } ?>
                                    <?php } ?>
                                    <!--10 -->
                                    <?php
                                    $z = "select * from tbl_yhq where userid='" . $_COOKIE['userid'] . "' and state=1 and type=1 and UNIX_TIMESTAMP(lasttime)>UNIX_TIMESTAMP(now()) and money=10";
                                    $x = mysql_query($z);
                                    $rows10 = mysql_fetch_array($x);
                                    if ($rows10) {
                                        $coupon40 = array_sum($coupon4);
                                        $coupon50 = array_sum($coupon5);
                                        if ($coupon40 >= 199 || $coupon50 >= 159) {
                                            ?>
                                            <option value="<?php echo $rows10['money'] . 'and' . $rows10['id']; ?>"
                                                    style="text-align: center;">
                                                代金券：￥<?php echo $rows10['money'] ?></option>
                                        <?php } ?>
                                    <?php } ?>
                                    <!--3 -->
                                    <?php
                                    $z = "select * from tbl_yhq where userid='" . $_COOKIE['userid'] . "' and state=1 and type=1 and UNIX_TIMESTAMP(lasttime)>UNIX_TIMESTAMP(now()) and money=3";
                                    $x = mysql_query($z);
                                    $rows3 = mysql_fetch_array($x);
                                    if ($rows3) {
                                        $coupon30 = array_sum($coupon3);
                                        if ($coupon30 >= 79) {
                                            ?>
                                            <option value="<?php echo $rows3['money'] . 'and' . $rows3['id']; ?>"
                                                    style="text-align: center;">
                                                代金券：￥<?php echo $rows3['money'] ?></option>
                                        <?php } ?>
                                    <?php } ?>
                                    <!--2 -->
                                    <?php
                                    $z = "select * from tbl_yhq where userid='" . $_COOKIE['userid'] . "' and state=1 and type=1 and UNIX_TIMESTAMP(lasttime)>UNIX_TIMESTAMP(now()) and money=2";
                                    $x = mysql_query($z);
                                    $rows2 = mysql_fetch_array($x);
                                    if ($rows2) {
                                        $coupon00 = array_sum($coupon0);
                                        $coupon10 = array_sum($coupon1);
                                        $coupon20 = array_sum($coupon2);
                                        if ($coupon00 >= 59 || $coupon10 >= 39 || $coupon20 >= 59) {
                                            ?>
                                            <option value="<?php echo $rows2['money'] . 'and' . $rows2['id']; ?>"
                                                    style="text-align: center;">
                                                代金券：￥<?php echo $rows2['money'] ?></option>
                                        <?php } ?>
                                    <?php } ?>
                                    <!-- 自营商品优惠券规则 end -->
                                <? } elseif ($hotlevel != 0) { ?>

                                    <!-- 热销产品优惠券规则 start -->
                                    <?
                                    /**
                                     * 3类产品，单笔订单满299元可抵扣25元优惠券；单笔订单满199元可抵扣10元优惠券；
                                     * 2类产品，单笔订单满189元可抵扣20元优惠券；
                                     * 1类产品，单笔订单满89元可抵扣3元优惠券；单笔订单满65元可抵扣2元优惠券；
                                     */
                                    if ($hotlevel == 3) {
                                        if ($rowfee['totfee'] >= 299) {
                                            $t_money = 25;
                                        } elseif ($rowfee['totfee'] >= 199) {
                                            $t_money = 10;
                                        } else {
                                            $t_money = 0;
                                        }
                                        $sql = "select * from tbl_yhq where userid='" . $_COOKIE['userid'] . "' and state=1 and type=1 and UNIX_TIMESTAMP(lasttime)>UNIX_TIMESTAMP(now()) and money=$t_money limit 1";
                                        $re = c_getRow($sql);
                                        if ($re) {
                                            $money = $re['money'];
                                            $id = $re['id'];
                                            echo "<option style='text-align: center;' value='" . $money . 'and' . $id . "'>代金券：￥$money</option>";
                                        }
                                    } elseif ($hotlevel == 2) {
                                        if ($rowfee['totfee'] >= 189) {
                                            $t_money = 25;
                                        } else {
                                            $t_money = 0;
                                        }
                                        $sql = "select * from tbl_yhq where userid='" . $_COOKIE['userid'] . "' and state=1 and type=1 and UNIX_TIMESTAMP(lasttime)>UNIX_TIMESTAMP(now()) and money=$t_money limit 1";
                                        $re = c_getRow($sql);
                                        if ($re) {
                                            $money = $re['money'];
                                            $id = $re['id'];
                                            echo "<option style='text-align: center;' value='" . $money . 'and' . $id . "'>代金券：￥$money</option>";
                                        }
                                    } elseif ($hotlevel == 1) {
                                        if ($rowfee['totfee'] >= 89) {
                                            $t_money = 3;
                                        } elseif ($rowfee['totfee'] >= 65) {
                                            $t_money = 2;
                                        } else {
                                            $t_money = 0;
                                        }
                                        $sql = "select * from tbl_yhq where userid='" . $_COOKIE['userid'] . "' and state=1 and type=1 and UNIX_TIMESTAMP(lasttime)>UNIX_TIMESTAMP(now()) and money=$t_money limit 1";
                                        $re = c_getRow($sql);
                                        if ($re) {
                                            $money = $re['money'];
                                            $id = $re['id'];
                                            echo "<option style='text-align: center;' value='" . $money . 'and' . $id . "'>代金券：￥$money</option>";
                                        }
                                    }


                                    ?>

                                    <!-- 热销产品优惠券规则 end -->

                                <? } ?>

                            </select>

                        </div>
                    </div>
                <?php } ?>
                <!--发票 -->
                <div class="order-extra" style="width:100%;">
                    <div class="order-user-info" style="float:left;">
                        <div id="holyshit257" class="memo">
                            <label>是否开具发票：</label>
                        </div>
                    </div>
                    <div style="float:right;">
                        <input type="radio" class="recip" name="recip" value="1" title="是">是
                        <input type="radio" class="recip" name="recip" value="0" title="否" checked
                               style="margin-left: 10px">否
                    </div>
                </div>

                <div class="order-extra" id="taxinput" style="display: none;width:100%;">
                    <div class="order-user-info" style="float:left;">
                        <div id="holyshit257" class="memo">
                            <label>发票选择：</label>
                        </div>
                    </div>
                    <div style="float:right;">
                        <span id="cc1" onclick="cc1()" style="border: 1px solid #c3c3c3;padding:4px;">个人</span>
                        <span id="cc2" onclick="cc2()" style="border: 1px solid #c3c3c3;padding:4px;margin-left: 10px">企业</span>
                        <input type="hidden" id="sincom" value="">
                        <!-- <input type="radio" class="cc" value="1" checked>个人
                        <input type="radio" class="cc" value="0" style="margin-left: 10px">企业  -->
                    </div>
                </div>

                <div class="order-extra" id="dd" style="display: none;width:100%;">
                    <div class="order-user-info" style="float:left;">
                        <div id="holyshit257" class="memo">
                            <label>发票填写：</label>
                        </div>
                    </div>
                    <div style="float:right;">
                        <input id="taxman" name="taxman" type="text" placeholder="请输入抬头名称" value=""/>
                    </div>
                </div>

                <div class="order-extra" id="ee" style="display: none;width:100%;">
                    <div class="order-user-info" style="float:left;">
                        <div id="holyshit257" class="memo">
                            <label>发票填写：</label>
                        </div>
                    </div>
                    <div style="float:right;">
                        <input id="taxcom" name="taxcom" type="text" placeholder="请输入企业名称" value=""/>
                        <input id="taxconfig" name="taxconfig" type="text" placeholder="请填写纳税人识别号" value=""/>
                    </div>
                </div>

            </div>
            <!--含运费小计 -->

            <div class="buy-point-discharge ">
                <input type="hidden" id="oripri" value="<?php echo $rowfee['totfee']; ?>">
                <p class="price g_price ">
                    合计（含运费） <span>¥</span><em class="pay-sum" id="paysum"></em>
                </p>
            </div>
            <div class="buy-point-discharge " id="showrecip" style="display: none;">
                <p class="price g_price ">
                    税费 <span>¥</span><em class="pay-sum" id="totpri2"></em>
                </p>
            </div>
            <div class="buy-point-discharge ">
                <p class="price g_price ">
                    实付款 <span>¥</span><em class="pay-sum" id="realsum"></em>
                </p>
            </div>


        </div>
        <div id="holyshit269" class="submitOrder">
            <div class="go-btn-wrap">
                <p>
                    <button type="submit" class="am-btn am-btn-primary" style="float: right;">确认订单</button>
                </p>
            </div>
        </div>
        <div class="clear"></div>
    </div>

</form>

<? include('footerr.php'); ?>

<script type="text/javascript">

    var yhq = 0;

    $('#yhq').change(function () {
        var str = $(this).val();
        var arr = str.split("and");
        yhq = arr[0];
    });

    function Aaa() {

        var totfee = $('#oripri').val();
        var h = 0;
        var k = totfee - yhq;
        $('#paysum').text(k);

        var obj = $(".recip");
        for (var i = 0; i < obj.length; i++) {
            if (obj[i].checked) {
                if (obj[i].value == 1) {
                    h = k * 0.17;
                    h = h.toFixed(2);
                    $('#totpri2').text(h);
                    $('#showrecip').css("display", "block");
                    $('#taxinput').css("display", "block");
                } else {
                    h = 0;
                    $('#taxinput').css("display", "none");
                    $('#dd').css("display", "none");
                    $('#ee').css("display", "none");
                    $('#showrecip').css("display", "none");
                }
            }
        }

        j = parseFloat(h) + parseFloat(k);
        j = j.toFixed(2);
        if (j > 0) {
            $('#realsum').text(j);
        } else {
            $('#realsum').text(0);
        }
    }

    function cc1() {
        $('#cc1').css("background-color", "#019285").siblings().css("background-color", "#fff");
        $('#dd').css("display", "block");
        $('#ee').css("display", "none");
        $('#sincom').val(1);
    }
    function cc2() {
        $('#cc2').css("background-color", "#019285").siblings().css("background-color", "#fff");
        $('#dd').css("display", "none");
        $('#ee').css("display", "block");
        $('#sincom').val(2);
    }
</script>

<script type="text/javascript">
    function checktax() {

        var istax = $("input[name='recip']:checked").val();
        var sincom = $('#sincom').val();
        var taxman = $('#taxman').val();
        var taxcom = $('#taxcom').val();
        var taxconfig = $('#taxconfig').val();
        if (istax == 1) {
            if (sincom == 1) {
                if (taxman == "") {
                    alert("请填写个人发票信息!");
                    return false;
                }
            } else if (sincom == 2) {
                if (taxcom == "" || taxconfig == "") {
                    alert("请填写企业发票信息!");
                    return false;
                }
            }
        }
        return true;
    }

</script>

</body>
</html>